package com.example.mq;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;

public class RokcetProducer {
    public static void main(String[] args) {
        DefaultMQProducer producer=new DefaultMQProducer("ProducerGroupName");
//        producer.setNamesrvAddr("10.13.8.234:8100;10.13.8.233:8100");
        producer.setNamesrvAddr("10.13.10.251:8100;10.13.10.174:8100");
        producer.setUseTLS(true);
        try{
            producer.start();
            Message msg=new Message("test1","TagName","OrderID","Message".getBytes(RemotingHelper.DEFAULT_CHARSET));
            SendResult sendResult=producer.send(msg);
            System.out.printf("%s%n",sendResult);
        }catch (Exception e){
            e.printStackTrace();
        }
        producer.shutdown();
    }
}
